﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using Clipper.Model.ViewModel;
using System.Windows;
using Clipper.Model.EnumModel;

namespace Clipper.Model
{
    /// <summary>
    /// 反应条
    /// </summary>
    [Serializable]
    public class ReactionStrip : AbstractModel
    {
        int _id;
        /// <summary>
        /// 序号,从1开始
        /// </summary>
        public int ID
        {
            get
            {
                return _id;
            }
            set
            {
                _id = value;
            }
        }

        private ObservableCollection<ReactionCup> cupHole;

        //public static ObservableCollection<ReactionCup> CupHole
        //{
        //    get
        //    {
        //        return cupHole;
        //    }

        //    set
        //    {
        //        cupHole = value;
        //    }
        //}

        //定义的枚举类型
        ReactionStripStatusEnum _stripStatus;
        public ReactionStripStatusEnum StripStatus
        {
            get
            {
                return _stripStatus;
            }

            set
            {
                _stripStatus = value;
            }
        }


        ObservableCollection<ReactionCup> _reactionCupList;
        /// <summary>
        /// 反应杯列表
        /// </summary>
        public ObservableCollection<ReactionCup> ReactionCupList
        {
            get
            {
                if (_reactionCupList == null)
                {
                    _reactionCupList = new ObservableCollection<ReactionCup>();
                }
                return _reactionCupList;
            }
            set
            {
                _reactionCupList = value;
                NotifyPropertyChanged("ReactionCupList");
            }
        }
        #region 孵育和恒温等待
        byte _incubatorSeat;
        /// <summary>
        /// 孵育箱位置
        /// </summary>
        public byte IncubatorSeat
        {
            get
            {
                return _incubatorSeat;
            }
            set
            {
                _incubatorSeat = value;
                NotifyPropertyChanged("IncubatorSeat");
            }
        }
        byte _waitSeat;
        /// <summary>
        /// 等待箱中位置
        /// </summary>
        public byte WaitSeat
        {
            get
            {
                return _waitSeat;
            }
            set
            {
                _waitSeat = value;
                NotifyPropertyChanged("WaitSeat");
            }
        }
        DateTime _incubatorEnd;
        /// <summary>
        /// 孵育结束时间
        /// </summary>
        public DateTime IncubatorEnd
        {
            get
            {
                return _incubatorEnd;
            }
            set
            {
                _incubatorEnd = value;
                NotifyPropertyChanged("IncubatorEnd");
            }
        }
        DateTime _lightDetectEnd;
        /// <summary>
        /// 光电反应结束时间
        /// </summary>
        public DateTime LightDetectEnd
        {
            get
            {
                return _lightDetectEnd;
            }
            set
            {
                _lightDetectEnd = value;
                NotifyPropertyChanged("LightDetectEnd");
            }
        }
        byte _whileIncubator;
        /// <summary>
        /// 孵育用时（分钟）模拟是秒
        /// </summary>
        public byte WhileIncubator
        {
            get
            {
                return _whileIncubator;
            }
            set
            {
                _whileIncubator = value;
                NotifyPropertyChanged("WhileIncubator");
            }
        }
        byte _whileIncubator1 = 0;
        /// <summary>
        /// 两步法第一次孵育用时
        /// </summary>
        public byte WhileIncubator1
        {
            get
            {
                return _whileIncubator1;
            }
            set
            {
                _whileIncubator = value;
                NotifyPropertyChanged("WhileIncubator1");
            }
        }
        byte _whileIncubator2;
        /// <summary>
        /// 两步法第二次孵育用时
        /// </summary>
        public byte WhileIncubator2
        {
            get
            {
                return _whileIncubator2;
            }
            set
            {
                _whileIncubator2 = value;
                NotifyPropertyChanged("WhileIncubator2");
            }
        }
        byte _whileLightReact;
        /// <summary>
        /// 恒温等待用时（分钟）模拟是秒
        /// </summary>
        public byte WhileLightReact
        {
            get
            {
                return _whileLightReact;
            }
            set
            {
                _whileLightReact = value;
                NotifyPropertyChanged("WhileLightReact");
            }
        }

        #endregion

        #region 检测时间
        DateTime _detectStartTime;
        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime DetectStartTime
        {
            get
            {
                return _detectStartTime;
            }
            set
            {
                _detectStartTime = value;
                NotifyPropertyChanged("DetectStartTime");
            }
        }
        DateTime _detectEndTime;
        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime DetectEndTime
        {
            get
            {
                return _detectEndTime;
            }
            set
            {
                _detectEndTime = value;
                NotifyPropertyChanged("DetectEndTime");
            }
        }
        TimeSpan _timeConsuming;
        /// <summary>
        /// 检测耗时
        /// </summary>
        public TimeSpan TimeConsuming
        {
            get
            {
                return _timeConsuming;
            }
            set
            {
                _timeConsuming = value;
                NotifyPropertyChanged("TimeConsuming");
            }
        }
        #endregion

        ReactionStripStageEnum _reactionStripSeat;
        /// <summary>
        /// 反应条位置
        /// </summary>
        public ReactionStripStageEnum ReactionStripSeat
        {
            get
            {
                return _reactionStripSeat;
            }
            set
            {
                _reactionStripSeat = value;
                this.NotifyPropertyChanged("ReactionStripSeat");
            }
        }
        DetectionMethodEnum _detectionMethod;
        /// <summary>
        /// 检测方法
        /// </summary>
        public DetectionMethodEnum DetectionMethod
        {
            get
            {
                return _detectionMethod;
            }
            set
            {
                _detectionMethod = value;
            }
        }
        bool mFirstIncubation = true;
        /// <summary>
        /// 确定是否孵育第一次孵育，只有两步法使用
        /// </summary>
        public bool FirstIncubation
        {
            get
            {
                return mFirstIncubation;
            }
            set
            {
                mFirstIncubation = value;
            }
        }
        /// <summary>
        /// 反应条图像
        /// </summary>
        public FrameworkElement ReactripView
        {
            get;
            set;
        }
        /// <summary>
        /// 图像位置
        /// </summary>
        public Point ReactionStripPoint
        {
            get;
            set;
        }
        //ComponentStateEnum _reactionStripState;
        ///// <summary>
        ///// 反应条状态
        ///// </summary>
        //public ComponentStateEnum ReactionStripState
        //{
        //    get
        //    {
        //        return _reactionStripState;
        //    }
        //    set
        //    {
        //        _reactionStripState = value;
        //        NotifyPropertyChanged("ReactionStripState");
        //    }
        //}

        string _note;
        public string Note
        {
            get
            {
                return _note;
            }
            set
            {
                _note = value;
            }
        }


        public static implicit operator Array(ReactionStrip v)
        {
            throw new NotImplementedException();
        }
    }
}
